#include "Handcard.h"
#include "globalVariables.h"

Handcard::Handcard(Card* card, int x, int y)
{
	this->x = x;
	this->y = y;
	this->card = card;
	this->isMoving = false;
	this->isPressed = false;
	this->isSelected = false;
}

Handcard::~Handcard()
{
	delete card;
}

int Handcard::paint(SDL_Renderer* renderer)
{
	card->paint(renderer, x, y);
	return 0;
}
int Handcard::paintSmall(SDL_Renderer* renderer)
{
	card->paintSmall(renderer, x, y);
	return 0;
}

int Handcard::paintBack(SDL_Renderer* renderer)
{
	card->paintBack(renderer, x, y);
	return 0;
}

int Handcard::press()
{
	if (!isSelected)
	{
		isSelected = true;
		y -= 30;
	}
	//select board calculate
	for (int i = 0; i < 7; i++)
	{
		for (int j = 0; j < 9; j++)
		{
			selectBoard[i][j] = card->canSelect(i, j);
		}
	}
	return 0;
}

int Handcard::release()
{
	if (isSelected)
	{
		isSelected = false;
		y += 30;
	}
	return 0;
}